<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.tb_orderstate.Tb_orderstateInfo" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%@page import="com.lmpop.trade.ti_admin.Ti_adminInfo" %>

<%
	request.setCharacterEncoding("UTF-8");
	
	Hashtable params = new Hashtable();
	
	String  order_id=""; 
	if(request.getParameter("order_id")!=null )
	{
	   order_id  =request.getParameter("order_id");		
	}
  params.put("s_order_id",order_id);	
  
  String s_goods_name="",s_start_date="",s_end_date="",s_state_code="";
  if(request.getParameter("s_goods_name")!=null && !request.getParameter("s_goods_name").trim().equals("") )
	{
	   s_goods_name  =request.getParameter("s_goods_name");
	   
     //out.println("-------->"+s_goods_name); 
	   
	   params.put("s_goods_name",s_goods_name);		
	}
	if(request.getParameter("s_start_date")!=null && !request.getParameter("s_start_date").trim().equals(""))
	{
	   s_start_date  =request.getParameter("s_start_date");
	   params.put("s_start_date",s_start_date);		
	}
  if(request.getParameter("s_end_date")!=null && !request.getParameter("s_end_date").trim().equals(""))
	{
	   s_end_date  =request.getParameter("s_end_date");
	   params.put("s_end_date",s_end_date);		
	}
   if(request.getParameter("s_state_code")!=null && !request.getParameter("s_state_code").trim().equals(""))
	{
	   s_state_code  =request.getParameter("s_state_code");
	   params.put("s_state_code",s_state_code);		
	}
  
  Tb_orderstateInfo  tb_orderstateInfo = new Tb_orderstateInfo(); 	
	
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	
	
	List list = tb_orderstateInfo.getListByPage(params,Integer.parseInt(iStart),limit);
	int counter = tb_orderstateInfo.getCountByObj(params);
	
	String querpage="orderActiondetail.jsp?s_state_code="+s_state_code+"&s_end_date="+s_end_date+"&s_start_date="+s_start_date+"&s_goods_name="+s_goods_name+"&order_id="+order_id+"&iStart=";	
	String pageString = new PageTools().getGoogleToolsBar(counter,querpage,Integer.parseInt(iStart),limit);
  
  Ti_adminInfo  ti_adminInfo  =new Ti_adminInfo();
%>
<html>
  <head>
    
   <title>ti_orderinfo Manager</title>
	 <link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	 <script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
 
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>订单处理日志</h1>
			</td>
			<td>
			</td>
		</tr>
	</table>
	
	<form action="orderActiondetail.jsp" name="indexForm" method="post">
  
  <table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				商品名称:<input name="s_goods_name" type="text" />
        变化时间段:  
          <input name="s_start_date" type="text" id="s_start_date" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'s_end_date\',{d:-1})}',readOnly:true})" size="15"  width="150px"/>
            -
	        <input name="s_end_date" id="s_end_date" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'s_start_date\',{d:1})}',readOnly:true})" size="15" width="150px"/>
			   
         订单详细状态: 
         <select id="s_state_code" name="s_state_code">
          <option value="">请选择</option> 
          <option value="b">已确认</option>
          <option value="d">无效</option>
          <option value="f">配货中</option>
          <option value="g">已发货</option>  
          <option value="j">已付款</option>  
          <option value="l">退款确认</option>
          <option value="m">交易完成</option> 
        
	      </select>						
				
				<input name="searchInfo" type="button" value="查询" onclick="javascript:document.indexForm.submit();"/>	
			</td>
		</tr>
	</table>
                                                       
                                                         
                                                         
                                                         
                                                         
                                                         	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
			  	 
			  	 <input type="button" name="ret" onclick="javascript:window.location.href='index.jsp'" value="返回" class="buttab"/>
                                                                               			
			</td>
			<td>
				总计:<%=counter %>条			
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
					
		  	<th>商品名称</th>
		  	
		  	<th>订单详细状态</th>
		  		  	
		  	<th>状态变化时间</th>
		           
        <th>操作人</th>
				  	  
	  	  </tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			    Hashtable map = (Hashtable)list.get(i);
		  		   	    String state_name="",state_date="",user_id="",goods_name="";	  			  
		  			    if(map.get("state_name")!=null) state_name = map.get("state_name").toString();
					  	if(map.get("state_date")!=null) state_date = map.get("state_date").toString();
					  	if(state_date.length()>19){state_date = state_date.substring(0,19);}
					  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
					  	if(map.get("goods_name")!=null) goods_name = map.get("goods_name").toString();
						String user_name="";
						if(!user_id.equals(""))
						{      
						    user_name = ti_adminInfo.getUserNameByPK(user_id); 
						}             
              					     	  	
		  %>
		
		<tr>
					
		  			  	
		  	<td>
		  	   <%=goods_name%>		
		  	</td>
		  	
		  	<td>
		  		 <%=state_name%>
		   </td>
		  		  	
		  	<td><%=state_date%></td>
		  	         
      <td><%=user_name%></td>
		 		  	
		  </tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
			
			  <input type="button" name="ret" onclick="javascript:window.location.href='index.jsp'" value="返回" class="buttab"/>

			
			</td>
			<td>
				总计:<%=counter %>条			
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="order_id" id="order_id" value="<%=order_id %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="0213" />
	  </form>
</body>

</html>
